/*
 * dronus.h
 *
 * Created: 28/01/2014 23:39:48
 *  Author: usuario
 */ 


#ifndef DRONUS_H_
#define DRONUS_H_

#include <rtos.h>

#define DRONUS_VERSION	"0.40"

#define STRING_EOL    "\r\n"
#define STRING_HEADER "\r\n-- DRONUS " DRONUS_VERSION " --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL

#define MAIN_TASK_PRIORITY				( tskIDLE_PRIORITY + 8			)
#define BLACKBOX_TASK_PRIORITY			( tskIDLE_PRIORITY + 5			)
#define USART_TASK_PRIORITY				( tskIDLE_PRIORITY + 3			)
#define CLI_TASK_PRIORITY				( tskIDLE_PRIORITY + 3			)
#define	MSC_TASK_PRIORITY				( tskIDLE_PRIORITY + 2			)
#define	BLINKY_TASK_PRIORITY			( tskIDLE_PRIORITY + 1			)

#define MAIN_ELAPSE						( 1000  *   portTICK_RATE_MS		)
#define USART_TX_ELAPSE					( 20  *   portTICK_RATE_MS		)
#define USART_RX_ELAPSE					( 20  *   portTICK_RATE_MS		)
#define BLINKY_ELAPSE					( 200 *   portTICK_RATE_MS		)
#define BLACKBOX_ELAPSE					( 1000 *  portTICK_RATE_MS		)

#define MAIN_TASK_STACK_SIZE			( configMINIMAL_STACK_SIZE + 1024)
#define MSC_TASK_STACK_SIZE				( configMINIMAL_STACK_SIZE + 256)
#define BLACKBOX_TASK_STACK_SIZE		( configMINIMAL_STACK_SIZE + 256)
#define CLI_TASK_STACK_SIZE				( configMINIMAL_STACK_SIZE + 256)
#define USART_RX_TASK_STACK_SIZE		( configMINIMAL_STACK_SIZE + 16	)
#define USART_TX_TASK_STACK_SIZE		( configMINIMAL_STACK_SIZE + 8	)
#define BLINKY_TASK_STACK_SIZE			( configMINIMAL_STACK_SIZE + 4	)

#define PULSE_IRQ_PRIORITY				configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY+4
#define PWM_IRQ_PRIORITY				configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY+3
#define MSC_IRQ_PRIORITY				configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY+2
#define USART_IRQ_PRIORITY				configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY+1
#define TWI_IRQ_PRIORITY				configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY

xSemaphoreHandle usb_access;

#endif /* DRONUS_H_ */